<template>
  <div class="container-item">
    <div v-if="title" class="item-title">{{ title }}</div>
    <div v-for="(item, index) in getConfigList()" :key="index">
      <a-form-item :colon="false" :label="item.label">
        <a-input
          v-if="item.type === 'input'"
          v-decorator="[item.value, { rules: item.rules }]"
          :type="item.kbType ? item.kbType : 'text'"
        />
        <a-select v-if="item.type === 'select'" v-decorator="[item.value, { rules: item.rules }]" :options="item.options" />
      </a-form-item>
    </div>
  </div>
</template>
<script>
export default {
  name: "BasicForm",
  props: {
    scope: [String, Number],
    fieldList: {
      type: Array,
      default: () => []
    },
    attrs: {
      type: Object,
      default: () => {}
    },
    rules: {
      type: Object,
      default: () => {}
    },
    title: {
      type: String,
      default: ""
    }
  },

  methods: {
    getConfigList() {
      return this.fieldList;
    }
  }
};
</script>
<style lang="scss" scoped>
.item-title {
  min-width: 80px;
  max-width: 140px;
  display: inline-block;
  height: 24px;
  line-height: 24px;
  padding: 0 13px;
  text-align: center;
  background: var(--primary10);
  border-left: 2px solid var(--primary);
  margin: 20px 0 15px 70px;
}

.item-title {
  min-width: 80px;
  max-width: 140px;
  display: inline-block;
  height: 24px;
  line-height: 24px;
  padding: 0 13px;
  text-align: center;
  background: rgba(255, 175, 79, 0.19);
  border-left: 2px solid var(--primary);
  margin: 20px 0 15px 70px;
}

.ant-form-item {
  margin-top: -5px;
}

>>> .ant-select,
.ant-calendar-picker,
.ant-cascader-picker,
.ant-input {
  width: 90%;
  height: 36px;
  background-color: #f5f5f5;
}
>>> .ant-cascader-input {
  height: 36px;
  background-color: #f5f5f5;
}

>>> .ant-select-selection,
>>> .ant-calendar-picker-input {
  background-color: #f5f5f5;
  height: 36px;
}

.button-area {
  width: 100%;
  height: 58px;
  line-height: 58px;
  border-top: 1px solid #e5e5e5;
  margin-top: 40px;
  text-align: right;
  padding-right: 40px;
  padding-top: 30px;
}
</style>
